package cn.ljy.mes.model;

import cn.ljy.common.model.BaseModel;
import cn.ljy.common.model.validate.AddWorkValidation;
import cn.ljy.common.model.validate.UpdateWorkValidation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.*;
import java.util.Date;

@ApiModel(value = "商品类别")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false, of = {"id"})
public class ShopProductType extends BaseModel {

    @ApiModelProperty(value = "类别ID", example = "1")
    @NotNull(groups = UpdateWorkValidation.class, message = "类别ID不能为空")
    private Long id;

    @ApiModelProperty(value = "类别名称", required = true, example = "电池材料")
    @NotBlank(groups = AddWorkValidation.class, message = "类别名称不能为空")
    @Size(min = 1, max = 30, message = "类别名称长度必须在 {min} - {max} 之间")
    private String name;

    @ApiModelProperty(value = "排序，升序", required = true, example = "100")
    @NotNull(groups = AddWorkValidation.class, message = "排序不能为空")
    @Min(value = 0, message = "排序值不能小于0")
    private Integer sort;

    @ApiModelProperty(value = "是否启用", required = true, example = "true")
    @NotNull(groups = AddWorkValidation.class, message = "启用状态不能为空")
    private Boolean enabled;

    @ApiModelProperty(value = "创建时间", example = "2024-11-05 10:00:00")
    private Date createTime;

    @ApiModelProperty(value = "更新时间", example = "2025-08-16 20:31:57")
    private Date updateTime;

    public ShopProductType(Long id) {
        this.id = id;
    }
}
